export function toData (target, name, descriptor) {
  const original = descriptor.value
  descriptor.value = async function (...args) {
    console.log(`Arguments: ${args}`)
    const res = await original.apply(this, args)
    res.data = this.toData(res.data)
    return res
  }
  return descriptor
}
// 隐含bind
export function fromData (target, name, descriptor) {
  const original = descriptor.value// 会修改this
  descriptor.value = async function (...args) {
    const res = await original.apply(this, ...args)
    res.data = this.fromData(res.data)
    console.log(res)
    return res
  }
  return descriptor
}

export function bind (target, name, descriptor) {
  target.constructor[name] = descriptor.value.bind(this)
  return descriptor
}
